package set;

import org.junit.Test;

import set.Set.Visitor;

public class SetTest {
	@Test
	public void testLinkedSet() throws Exception {
		Set<Integer> set = new LinkedSet<>();
		set.add(20);
		set.add(10);
		set.add(32);
		set.add(9);
		set.add(40);
		set.add(32);
		
		set.traversal(new Visitor<Integer>() {

			@Override
			public boolean visit(Integer element) {
				System.out.println(element);
				return false;
			}
		});
		System.out.println("size = " + set.size());
	}
	@Test
	public void testTreeSet() throws Exception {
		Set<Integer> set = new TreeSet<>();
		set.add(20);
		set.add(10);
		set.add(32);
		set.add(9);
		set.add(40);
		set.add(32);
		
		set.traversal(new Visitor<Integer>() {
			
			@Override
			public boolean visit(Integer element) {
				System.out.println(element);
				return false;
			}
		});
		System.out.println("size = " + set.size());
	}
}
